var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/businessComponent/express/component/functionInfo/index.tsx
var functionInfo_exports = {};
__export(functionInfo_exports, {
  default: () => functionInfo_default
});
module.exports = __toCommonJS(functionInfo_exports);
var import_react = require("react");
var import_baseComponent = require("../../../../baseComponent");
var import_functionalComponent = require("../../../../functionalComponent");
var import_util = require("../../../../util");
function functionInfo_default({ currentFunc, childRef }) {
  const [activeKey, setactiveKey] = (0, import_react.useState)("1");
  const [validInfo, setValidInfo] = (0, import_react.useState)("");
  (0, import_react.useImperativeHandle)(childRef, () => {
    return {
      changeActiveKeyAndParmam
    };
  });
  const changeActiveKeyAndParmam = (n, d) => {
    setactiveKey(n);
    if (typeof d === "string") {
      setValidInfo(d);
    } else {
      setValidInfo(JSON.stringify(d));
    }
  };
  const items = (0, import_react.useMemo)(() => {
    return [
      {
        key: "1",
        label: "函数说明",
        children: /* @__PURE__ */ React.createElement("div", { style: { overflow: "auto", height: "100%", padding: "4px 11px", borderRadius: 4, ...(0, import_util.borderStyle)() } }, /* @__PURE__ */ React.createElement(FuncExplain, { info: currentFunc }))
      },
      {
        key: "2",
        label: "公式校验",
        children: /* @__PURE__ */ React.createElement(FormulaField, { data: validInfo })
      }
    ];
  }, [currentFunc, validInfo]);
  return /* @__PURE__ */ React.createElement("div", { style: { height: 150 } }, /* @__PURE__ */ React.createElement(import_functionalComponent.Tabs, { defaultActiveKey: "1", items, activeKey, onChange: (d) => setactiveKey(d) }));
}
function FuncExplain({ info }) {
  return info && /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { style: { fontWeight: "bold" } }, info.funcFullNameWithParam), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", { style: { fontWeight: "bold" } }, "名称:"), /* @__PURE__ */ React.createElement("span", null, info.funcChnName)), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", { style: { fontWeight: "bold" } }, "功能:"), /* @__PURE__ */ React.createElement("span", null, info.funcExplain)), /* @__PURE__ */ React.createElement("div", { className: "params" }, /* @__PURE__ */ React.createElement("span", { style: { fontWeight: "bold" } }, "参数:"), /* @__PURE__ */ React.createElement("div", { className: "paramsItem" }, info.params.map((item) => /* @__PURE__ */ React.createElement("span", { key: item }, item)))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", { style: { fontWeight: "bold" } }, "返回值:"), /* @__PURE__ */ React.createElement("span", null, info.returnType)));
}
function FormulaField({ data }) {
  return /* @__PURE__ */ React.createElement(import_baseComponent.TextArea, { value: data, disabled: true, style: { height: "100%", background: "#fff", color: import_util.cssVar.textColor } });
}
